package com.financing.platform.dao.impl;

import java.util.List;
import java.util.Map;
import com.financing.platform.dao.impl.BaseDaoImpl;
import com.financing.platform.dao.IFpFundAwkwardnessDao;
import com.financing.platform.dto.FpFundAwkwardnessDTO;
import com.financing.platform.util.SqlName;
import java.sql.SQLException;
import java.util.Collections;

import org.springframework.stereotype.Repository;

/**
 * @Description:实现类
 * @author caojiayao
 * @version 1.0
 * @created 
 */
@Repository("fpFundAwkwardnessDaoImpl")
public class FpFundAwkwardnessDaoImpl extends BaseDaoImpl implements IFpFundAwkwardnessDao {
	
	@Override
	public FpFundAwkwardnessDTO getFpFundAwkwardness(Integer id) {
		try{
			return (FpFundAwkwardnessDTO)this.sqlMapClient.queryForObject(SqlName.fpFundAwkwardness,id);
		} catch (SQLException e) {
			log.error("get fpFundAwkwardness error:",e);
			return null;
		}
	}
	
	
	@Override
	public Integer insertFpFundAwkwardness(FpFundAwkwardnessDTO fpFundAwkwardness) {
		try {
			return (Integer)this.sqlMapClient.insert(SqlName.insertFpFundAwkwardness,fpFundAwkwardness);
		} catch (SQLException e) {
			log.error("add fpFundAwkwardness error:",e);
			return null;
		}
	}

	
	@Override
	public Integer updateFpFundAwkwardness(FpFundAwkwardnessDTO fpFundAwkwardness) {
		try {
			return (Integer) this.sqlMapClient.update(SqlName.updateFpFundAwkwardness, fpFundAwkwardness);
		} catch (SQLException e) {
			this.log.error("update fpFundAwkwardness error 1!",e);
			return 0;
		}
	}
	
	@Override
	public Integer delFpFundAwkwardness(Integer id) {
		try{
			return (Integer) this.sqlMapClient.delete(SqlName.delFpFundAwkwardness, id);
		} catch (SQLException e) {
			log.error("del fpFundAwkwardness error:",e);
			return 0;
		}
	}
	
	@Override
	public List<FpFundAwkwardnessDTO> listFpFundAwkwardness(FpFundAwkwardnessDTO dto) {
		try {
			return (List<FpFundAwkwardnessDTO>)this.sqlMapClient.queryForList(SqlName.listFpFundAwkwardness, dto);
		} catch (SQLException e) {
			log.error("Query fpFundAwkwardness note list error !", e);
			return Collections.emptyList();
		}
	}
	
	public Integer countFpFundAwkwardness(FpFundAwkwardnessDTO dto) {
		try {
			return (Integer)this.sqlMapClient.queryForObject(SqlName.countFpFundAwkwardness, dto);
		} catch (SQLException e) {
			log.error("Query fpFundAwkwardness note list error !", e);
			return 0;
		}
	}
	
}
